﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WinServ_Fajry
{
    public partial class frm_PrayTimePanal : Form
    {
        #region Definitions
        double A, B, d, g, q, L, R, e, RA, D, EqT, jd;
        //d =  jd - 2451545.0;  // jd is the given Julian date 

        #endregion


        public frm_PrayTimePanal()
        {
            InitializeComponent();
            int month, year;
            month = DateTime.Now.Month;
            year = DateTime.Now.Year;

            if (month <= 2)
            {
                year -= 1;
                month += 12;
            };
            A = Math.Floor(double.Parse((year / 100).ToString()));
            B = 2 - A + Math.Floor(A / 4);
            jd = Math.Floor(365.25 * (year + 4716)) + Math.Floor(30.6001 * (month + 1)) + DateTime.Now.Day + B - 1524.5;
            //d = int.Parse(jd.ToShortDateString()) - 2451545.0;
            g = 357.529 + 0.98560028 * d;
            q = 280.459 + 0.98564736 * d;
            L = q + 1.915 * Math.Sin(g) + 0.020 * Math.Sin(2 * g);

            R = 1.00014 - 0.01671 * Math.Cos(g) - 0.00014 * Math.Cos(2 * g);
            e = 23.439 - 0.00000036 * d;
            RA = Math.Atan2(Math.Cos(e) * Math.Sin(L), Math.Cos(L)) / 15;

            D = Math.Asin(Math.Sin(e) * Math.Sin(L));  // declination of the Sun
            EqT = q / 15 - RA;  // equation of time

        }

        private void frm_PrayTimePanal_Load(object sender, EventArgs e)
        {
            PrayTime getPrayTimes = new PrayTime();
            string[] prayTimes = getPrayTimes.getDatePrayerTimes(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 24.6408333, 46.7727778, 3);
 

        }


    }
}
